﻿using DevelopTool.Model.CommonModels;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DevelopTool.Common
{
    /// <summary>
    /// 全局公用参数
    /// </summary>
    public static class GlobalData
    {

        /// <summary>
        /// 主窗体对象的引用（当前程序主窗体实例）
        /// </summary>
        public static UIForm MainForm { get; set; }

        /// <summary>
        /// 当前程序路径
        /// </summary>
        public static string AppPath
        {
            get
            {
                return Application.ExecutablePath;
            }
        }


        /// <summary>
        /// 当前程序运行目录
        /// </summary>
        public static string AppDirectory
        {
            get
            {
                return Path.GetDirectoryName(AppPath);
            }
        }


        /// <summary>
        /// 当前程序中文名称
        /// </summary>
        public static readonly string AppName_zh = "开发助手";

        /// <summary>
        /// 当前程序英文名称
        /// </summary>
        public static readonly string AppName_en = "DevelopTool";


        /// <summary>
        /// 当前程序作者
        /// </summary>
        public static readonly string Author = "yusufuy@qq.com";


        /// <summary>
        /// 本地数据库文件名称
        /// </summary>
        public static string AppDbName
        {
            get
            {
                return AppName_en + AppDbFileExtension;
            }
        }


        /// <summary>
        /// 数据库文件扩展名
        /// </summary>
        public static readonly string AppDbFileExtension = ".ysf";



        /// <summary>
        /// 当前系统用户应用程序的存储库（目录），末尾包括\
        /// </summary>
        public static string LocalUserDirectory
        {
            get
            {
                return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppName_en) + "\\";
            }
        }


        /// <summary>
        /// 临时目录路径，末尾包括\
        /// </summary>
        public static string AppTempDirectory
        {
            get
            {
                string tempPath = Path.Combine(Path.GetTempPath(), AppName_en);
                if (!Directory.Exists(tempPath))
                {
                    Directory.CreateDirectory(tempPath);
                }
                return tempPath + "\\";
            }
        }


        /// <summary>
        /// ini配置文件路径
        /// </summary>
        public static string IniFilePath
        {
            get
            {
                return Path.Combine(LocalUserDirectory, AppName_en + ".ini");
            }
        }

        /// <summary>
        /// dll文件搜索目录路径
        /// </summary>
        public static string DLLFilePath
        {
            get
            {
                return Path.Combine(LocalUserDirectory,"lib");
            }
        }

    }


    /// <summary>
    /// 应用程序配置
    /// </summary>
    public static class Setting
    {
        /// <summary>
        /// ini文件操作对象
        /// </summary>
        public static readonly IniFile Ini = new IniFile(GlobalData.IniFilePath, Encoding.UTF8);

        /// <summary>
        /// WiFi固定配置参数
        /// </summary>
        public static readonly WiFiFixator_Setting WiFiFixator = new WiFiFixator_Setting();

        /// <summary>
        /// 截图配置参数
        /// </summary>
        public static readonly ScreenShot_Setting ScreenShot = new ScreenShot_Setting();

        /// <summary>
        /// 工具配置参数
        /// </summary>
        public static readonly Tool_Setting Tool = new Tool_Setting();

        /// <summary>
        /// sql分析配置参数
        /// </summary>
        public static readonly SqlAnalyze_Setting SqlAnalyze = new SqlAnalyze_Setting();

        /// <summary>
        /// 定时任务配置参数
        /// </summary>
        public static readonly Scheduler_Setting Scheduler = new Scheduler_Setting();

        /// <summary>
        /// 笔记配置参数
        /// </summary>
        public static readonly Note_Setting Note = new Note_Setting();

        /// <summary>
        /// 文本编辑器配置参数
        /// </summary>
        public static readonly TextEditor_Setting TextEditor = new TextEditor_Setting();

        /// <summary>
        /// 系统配置参数
        /// </summary>
        public static readonly System_Setting System = new System_Setting();

        /// <summary>
        /// 主题配置参数
        /// </summary>
        public static readonly Theme_Setting Theme = new Theme_Setting();

        /// <summary>
        /// 电源计划配置参数
        /// </summary>
        public static readonly PowerPlan_Setting PowerPlan = new PowerPlan_Setting();


        /// <summary>
        /// 辅助输入配置参数
        /// </summary>
        public static readonly AuxiliaryInput_Setting AuxiliaryInput = new AuxiliaryInput_Setting();


        /// <summary>
        /// 扩展插件配置参数
        /// </summary>
        public static readonly Plugins_Setting Plugins = new Plugins_Setting();

        /// <summary>
        /// Markdown相关配置参数
        /// </summary>
        public static readonly Markdown_Setting Markdown = new Markdown_Setting();

        /// <summary>
        /// 局域网聊天配置参数
        /// </summary>
        public static readonly Chat_Setting Chat = new Chat_Setting();

        /// <summary>
        /// 桌面时钟配置参数
        /// </summary>
        public static readonly DesktopClock_Setting DesktopClock = new DesktopClock_Setting();
    }

    /// <summary>
    /// 桌面时钟配置参数
    /// </summary>
    public class DesktopClock_Setting
    {
        /// <summary>
        /// 需要显示的显示器对象集合
        /// </summary>
        public List<string> Screens
        {
            get
            {
                byte[] bytes = Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), ConvertHelper.ObjectToByte(new List<string>()).ToHexString()).ToHexBytes();
                return ConvertHelper.ByteToObject<List<string>>(bytes);
            }
            set
            {
                if (value == null)
                {
                    Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), ConvertHelper.ObjectToByte(new List<string>()).ToHexString());
                }
                else
                {
                    Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), ConvertHelper.ObjectToByte(value).ToHexString());
                }
            }
        }

        /// <summary>
        /// 字体
        /// </summary>
        public string FontFamily
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "微软雅黑");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 字体大小
        /// </summary>
        public float FontSize
        {
            get
            {

                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 80);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 字体样式
        /// </summary>
        public string FontStyle
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "Regular");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 文字颜色
        /// </summary>
        public Color ForeColor
        {
            get
            {
                return Color.FromArgb(Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), -11493121));// -32768 -11493121
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value.ToArgb());
            }
        }

        /// <summary>
        /// 是否显示日期
        /// </summary>
        public bool ShowDate
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }
    }

    /// <summary>
    /// 局域网聊天配置参数
    /// </summary>
    public class Chat_Setting
    {
        /// <summary>
        /// 聊天功能是否启用
        /// </summary>
        public bool Enable
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 是否每次启动后打开聊天窗口
        /// </summary>
        public bool AutoStartChatMainWindow
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 聊天文件保存路径
        /// </summary>
        public string BinarySavePath
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), Path.Combine(GlobalData.LocalUserDirectory, "Chat"));
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 当前用户唯一id
        /// </summary>
        public string UserId
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 当前用户监听端口号 默认：53537
        /// </summary>
        public int Port
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 53537);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 当前用户昵称
        /// </summary>
        public string NikeName
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 聊天功能是否启用音频提醒
        /// </summary>
        public bool NotifyAudio
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 聊天功能是否启用右下角弹窗提醒
        /// </summary>
        public bool NotifyPop
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }
    }


    /// <summary>
    /// Markdown相关配置参数
    /// </summary>
    public class Markdown_Setting
    {
        /// <summary>
        /// 是否代码高亮
        /// </summary>
        public bool CodeHighlighting
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 同步文档位置
        /// </summary>
        public bool SyncDocumentLocation
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }
    }

    /// <summary>
    /// 扩展插件配置参数
    /// </summary>
    public class Plugins_Setting
    {

        /// <summary>
        /// 扩展插件对象集合
        /// </summary>
        public List<PluginsModel> PluginsList
        {
            get
            {
                byte[] bytes = Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), ConvertHelper.ObjectToByte(new List<PluginsModel>()).ToHexString()).ToHexBytes();
                return ConvertHelper.ByteToObject<List<PluginsModel>>(bytes);
            }
            set
            {
                if (value == null)
                {
                    Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), ConvertHelper.ObjectToByte(new List<PluginsModel>()).ToHexString());
                }
                else
                {
                    Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), ConvertHelper.ObjectToByte(value).ToHexString());
                }
            }
        }

    }

    /// <summary>
    /// 辅助输入配置参数
    /// </summary>
    public class AuxiliaryInput_Setting
    {
        /// <summary>
        /// 辅助输入开始快捷键
        /// </summary>
        public string StartHotKey
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "Control  F6");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }
    }


    /// <summary>
    /// 电源计划配置参数
    /// </summary>
    public class PowerPlan_Setting
    {
        /// <summary>
        /// 默认电源计划
        /// </summary>
        public string DefaultModelPlan
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "0");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 键鼠空闲时间
        /// </summary>
        public int IdleTimeout
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 60);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 离开模式电源计划
        /// </summary>
        public string LeaveModePlan
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "0");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// CPU使用率阈值
        /// </summary>
        public int CPUUsage
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 90);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 加速模式电源计划
        /// </summary>
        public string SpeedupModePlan
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "0");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

    }


    /// <summary>
    /// 主题配置参数
    /// </summary>
    public class Theme_Setting
    {
        /// <summary>
        /// 背景色
        /// </summary>
        public Color BackColor
        {
            get
            {
                return Color.FromArgb(Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), -12282625));
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value.ToArgb());
            }
        }

        /// <summary>
        /// 文字颜色
        /// </summary>
        public Color ForeColor
        {
            get
            {
                return Color.FromArgb(Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), -1));
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value.ToArgb());
            }
        }

        /// <summary>
        /// 字体
        /// </summary>
        public string FontFamily
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "宋体");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 字体大小
        /// </summary>
        public int FontSize
        {
            get
            {

                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 100);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        public UIMenuStyle ControlThemColor
        {
            get
            {

                return (UIMenuStyle)Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), (int)UIMenuStyle.Black);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), (int)value);
            }
        }


        /// <summary>
        /// 管理页控件左侧菜单宽度
        /// </summary>
        /// <param name="value"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public int ManageControlLeftWidth(int? value = null, string key = "")
        {
            if (value == null)
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), key + "_" + AssemblyHelper.GetExampleMethodName(), 200);
            }
            else
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), key + "_" + AssemblyHelper.GetExampleMethodName(), (int)value);
                return (int)value;
            }
        }
    }

    /// <summary>
    /// 文本编辑器配置参数
    /// </summary>
    public class TextEditor_Setting
    {
        /// <summary>
        /// 字体
        /// </summary>
        public string FontFamily
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "宋体");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 字体大小
        /// </summary>
        public int FontSize
        {
            get
            {

                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 10);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 字体样式
        /// </summary>
        public string FontStyle
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "Regular");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示行号
        /// </summary>
        public bool ShowLineNumbers
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示空格
        /// </summary>
        public bool ShowSpaces
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示界线
        /// </summary>
        public bool ShowVRuler
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示顶部标尺
        /// </summary>
        public bool ShowHRuler
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示辅助线
        /// </summary>
        public bool ShowGuidelines
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示tab
        /// </summary>
        public bool ShowTabs
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示结束符
        /// </summary>
        public bool ShowEOLMarkers
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 是否显示代码折叠
        /// </summary>
        public bool ShowFold
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 代码提示
        /// </summary>
        public bool ShowIntellisense
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 折叠样式
        /// </summary>
        public int FoldMarkStyle
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 0);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 操作面板折叠状态
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public bool PnlFunction_Collapsed(bool? value = null, string key = "")
        {
            if (value == null)
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), key + "_" + AssemblyHelper.GetExampleMethodName(), false);
            }
            else
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), key + "_" + AssemblyHelper.GetExampleMethodName(), (bool)value);
                return (bool)value;
            }
        }


        /// <summary>
        /// 格式化按钮是否选中
        /// </summary>
        /// <param name="value"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool FormatBtn_Selected(bool? value = null, string key = "")
        {
            if (value == null)
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), key + "_" + AssemblyHelper.GetExampleMethodName(), false);
            }
            else
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), key + "_" + AssemblyHelper.GetExampleMethodName(), (bool)value);
                return (bool)value;
            }
        }

    }


    /// <summary>
    /// 系统配置参数
    /// </summary>
    public class System_Setting
    {
        /// <summary>
        /// 锁屏时间（单位：分钟）
        /// </summary>
        public int LockScreen_Time
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 60);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 数据库文件路径
        /// </summary>
        public string DbFilePath
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), Path.Combine(GlobalData.AppDirectory, GlobalData.AppDbName));
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 窗口关闭方式，1=缩小到系统托盘，2=退出程序
        /// </summary>
        public int WindowsCloseType
        {
            get
            {

                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 1);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 自启动后窗口缩小到系统托盘
        /// </summary>
        public bool AutoStartWindowMini
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 自动登录
        /// </summary>
        public bool AutoLoging
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 飞书消息Hook地址
        /// </summary>
        public string FeiShuMsgHookAddress
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), string.Empty);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 需要发送消息的功能模块
        /// </summary>
        public List<string> SendMsgModule
        {
            get
            {
                string str = Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), string.Empty);
                if (string.IsNullOrEmpty(str)) return new List<string>();
                else
                {
                    return str.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                }
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), string.Join(";", value));
            }
        }
    }



    /// <summary>
    /// 工具配置参数
    /// </summary>
    public class Tool_Setting
    {
        /// <summary>
        /// 搜索程序集-默认目录路径
        /// </summary>
        public string SearchAssembly_FolderPath
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), string.Empty);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 图片浏览器-上次浏览的目录路径
        /// </summary>
        public string ImageView_LastFolderPath
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), string.Empty);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

    }




    /// <summary>
    /// 笔记配置参数
    /// </summary>
    public class Note_Setting
    {

    }

    /// <summary>
    /// 定时任务配置参数
    /// </summary>
    public class Scheduler_Setting
    {
        /// <summary>
        /// 定时任务日志保留天数
        /// </summary>
        public int LogRetain_Time
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 30);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }
    }

    /// <summary>
    /// sql分析配置参数
    /// </summary>
    public class SqlAnalyze_Setting
    {
        /// <summary>
        /// 总是显示字段窗口
        /// </summary>
        public bool AlwaysShowColumnWindow
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 总是显示Sql定位窗口
        /// </summary>
        public bool AlwaysShowSqlTextWindow
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }
    }




    /// <summary>
    /// 截图配置参数
    /// </summary>
    public class ScreenShot_Setting
    {

        /// <summary>
        /// 截图快捷键（热键）
        /// </summary>
        public string HotKey
        {
            get
            {

                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), "Alt, Control  N");
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }


        /// <summary>
        /// 是否始终显示本窗口
        /// </summary>
        public bool OnlyShowThisWindow
        {
            get
            {

                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 截图时是否显示鼠标
        /// </summary>
        public bool ShowMouse
        {
            get
            {

                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), false);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

    }

    /// <summary>
    /// WiFi固定配置
    /// </summary>
    public class WiFiFixator_Setting
    {
        /// <summary>
        /// WiFi连接优先级
        /// </summary>
        public int WiFiConnectionPriority
        {
            get
            {

                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 1);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// WiFi连接规则
        /// </summary>
        public int WiFiConnectionRules
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 1);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// WiFi监控间隔时间
        /// </summary>
        public int FixatorIntervalTime
        {
            get
            {
                return Setting.Ini.ReadInt(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), 30);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 自动开启WiFi监控
        /// </summary>
        public bool AutoStartFixator
        {
            get
            {
                return Setting.Ini.ReadBool(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), true);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

        /// <summary>
        /// 当前正在监控的WiFi
        /// </summary>
        public string FixatorSSID
        {
            get
            {
                return Setting.Ini.Read(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), string.Empty);
            }
            set
            {
                Setting.Ini.Write(AssemblyHelper.GetExampleClassName(), AssemblyHelper.GetExampleMethodName(), value);
            }
        }

    }


}
